package com.hunanwenli.controller.shop;

import com.alibaba.fastjson.JSON;
import com.hunanwenli.entity.ShopGoods;
import com.hunanwenli.entity.UserInfo;
import com.hunanwenli.service.login.FeignLoginService;
import com.hunanwenli.service.sk.FeignSkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author : wanzhenyu
 * @Description:
 * @date Date : 2022/4/5
 */
public class BaseController {
    @Autowired
    private FeignLoginService feignLoginService;

   public UserInfo getLoginUser(Model model, HttpServletRequest request){
       String uuid = (String)request.getSession().getAttribute("uuid");
       Integer uid = feignLoginService.selectUserId(uuid);
       UserInfo userInfo = feignLoginService.getUserInfoById(uid);
       model.addAttribute("userName",userInfo.getName()+",欢迎您");
       return userInfo;
   }
}
